package com.jianying.domain;

import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.jianying.shared.Utils;

/**
 * 订单
 * @author 
 *
 */
public class Order {
	
	public static enum State {
		placed,// '待接单',
	    pending,// '待处理',
	    preparing, //'备货中'
	    prepared,// '已备货',
	    processing,// '生产中',
	    processed,// '生产完成',
	    purchasing, //'采购中'
	    purchased,// '采购完成',
	    partially,// '部分交货',
	    finished,// '交货完成',
	    returned,// '客户退货'
	    canceled,//'取消'
	   
	}
	
	private Integer id;
	
	private String uuid;
	
	private String serialNo;
	
	private State workflowState;
	
	private Boolean hurry;
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date handOverAt;
	
	private Double price;
	
	private Integer customerId;
	
	private String customerName;
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date placeAt;
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date obtainAt;
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date dealAt;
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date dealtAt;

	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date deliverAt;
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date receiveAt;
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date returnAt;
	
	private String returnReason;
	
	private Integer settlementId;
	
	private String remark;

	private Integer sourceId;
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date voidAt;
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date retrieveAt;
	
	private String dealType;
	
	private String productNo;
	
	private String color;
	
	private String size;
	
	private String images;
	
	private Integer categoryId;
	
	private String categoryName;
	
	private Integer quantity;
	
	private String unit;
	
	private String productNote;
	
	private Integer tenantId;
	
	private Boolean follow;
	
	private String cancelReason;
	
	private Date cancelAt;
	
	private Integer deliveredQuantity;
	
	@JsonFormat(pattern = "yyyy-MM-dd")
	private Date createAt;
	
	private String specJson;
	
	private Integer bargainId;
	
	private String currency;
	
	private Double cnyPrice;
	
	private Boolean assist;
	
	@JsonProperty
	public String firstImage() {
		return Utils.firstImage(images);
	}
	
	@JsonProperty
	public List<String> imageArray() {
		return Utils.imageArray(images);
	}
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public String getSerialNo() {
		return serialNo;
	}

	public void setSerialNo(String serialNo) {
		this.serialNo = serialNo;
	}

	public State getWorkflowState() {
		return workflowState;
	}

	public void setWorkflowState(State workflowState) {
		this.workflowState = workflowState;
	}

	public Boolean getHurry() {
		return hurry;
	}

	public void setHurry(Boolean hurry) {
		this.hurry = hurry;
	}

	public Date getHandOverAt() {
		return handOverAt;
	}

	public void setHandOverAt(Date handOverAt) {
		this.handOverAt = handOverAt;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public Integer getCustomerId() {
		return customerId;
	}

	public void setCustomerId(Integer customerId) {
		this.customerId = customerId;
	}

	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public Date getPlaceAt() {
		return placeAt;
	}

	public void setPlaceAt(Date placeAt) {
		this.placeAt = placeAt;
	}

	public Date getObtainAt() {
		return obtainAt;
	}

	public void setObtainAt(Date obtainAt) {
		this.obtainAt = obtainAt;
	}

	public Date getDealAt() {
		return dealAt;
	}

	public void setDealAt(Date dealAt) {
		this.dealAt = dealAt;
	}

	public Date getDealtAt() {
		return dealtAt;
	}

	public void setDealtAt(Date dealtAt) {
		this.dealtAt = dealtAt;
	}

	public Date getDeliverAt() {
		return deliverAt;
	}

	public void setDeliverAt(Date deliverAt) {
		this.deliverAt = deliverAt;
	}

	public Date getReceiveAt() {
		return receiveAt;
	}

	public void setReceiveAt(Date receiveAt) {
		this.receiveAt = receiveAt;
	}

	public Date getReturnAt() {
		return returnAt;
	}

	public void setReturnAt(Date returnAt) {
		this.returnAt = returnAt;
	}

	public String getReturnReason() {
		return returnReason;
	}

	public void setReturnReason(String returnReason) {
		this.returnReason = returnReason;
	}

	public Integer getSettlementId() {
		return settlementId;
	}

	public void setSettlementId(Integer settlementId) {
		this.settlementId = settlementId;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Integer getSourceId() {
		return sourceId;
	}

	public void setSourceId(Integer sourceId) {
		this.sourceId = sourceId;
	}

	public Date getVoidAt() {
		return voidAt;
	}

	public void setVoidAt(Date voidAt) {
		this.voidAt = voidAt;
	}

	public Date getRetrieveAt() {
		return retrieveAt;
	}

	public void setRetrieveAt(Date retrieveAt) {
		this.retrieveAt = retrieveAt;
	}


	public String getDealType() {
		return dealType;
	}

	public void setDealType(String dealType) {
		this.dealType = dealType;
	}

	public Integer getTenantId() {
		return tenantId;
	}

	public void setTenantId(Integer tenantId) {
		this.tenantId = tenantId;
	}

	public Date getCreateAt() {
		return createAt;
	}

	public void setCreateAt(Date createAt) {
		this.createAt = createAt;
	}

	public String getProductNo() {
		return productNo;
	}

	public void setProductNo(String productNo) {
		this.productNo = productNo;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public String getSize() {
		return size;
	}

	public void setSize(String size) {
		this.size = size;
	}

	public String getImages() {
		return images;
	}

	public void setImages(String images) {
		this.images = images;
	}

	public Integer getCategoryId() {
		return categoryId;
	}

	public void setCategoryId(Integer categoryId) {
		this.categoryId = categoryId;
	}

	public String getCategoryName() {
		return categoryName;
	}

	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}

	public Integer getQuantity() {
		return quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public String getProductNote() {
		return productNote;
	}

	public void setProductNote(String productNote) {
		this.productNote = productNote;
	}

	public Boolean getFollow() {
		return follow;
	}

	public void setFollow(Boolean follow) {
		this.follow = follow;
	}

	public String getCancelReason() {
		return cancelReason;
	}

	public void setCancelReason(String cancelReason) {
		this.cancelReason = cancelReason;
	}

	public Date getCancelAt() {
		return cancelAt;
	}

	public void setCancelAt(Date cancelAt) {
		this.cancelAt = cancelAt;
	}

	public Integer getDeliveredQuantity() {
		return deliveredQuantity;
	}

	public void setDeliveredQuantity(Integer deliveredQuantity) {
		this.deliveredQuantity = deliveredQuantity;
	}

	public String getSpecJson() {
		return specJson;
	}

	public void setSpecJson(String specJson) {
		this.specJson = specJson;
	}

	public Integer getBargainId() {
		return bargainId;
	}

	public void setBargainId(Integer bargainId) {
		this.bargainId = bargainId;
	}

	public String getCurrency() {
		return currency;
	}

	public void setCurrency(String currency) {
		this.currency = currency;
	}

	public Double getCnyPrice() {
		return cnyPrice;
	}

	public void setCnyPrice(Double cnyPrice) {
		this.cnyPrice = cnyPrice;
	}

	public Boolean getAssist() {
		return assist;
	}

	public void setAssist(Boolean assist) {
		this.assist = assist;
	}
	
}
